package com.wutianyi.module.dao;

import java.util.List;

import com.wutianyi.module.commons.PropertyGroup;

public class PropertyGroupDaoMysqlImpl implements PropertyGroupDao {
	
	private PropertyGroupMapper propertyGroupMapper;
	
	@Override
	public void insertPropertyGroup(PropertyGroup pg) {
		propertyGroupMapper.insertPropertyGroup(pg);
	}
	
	@Override
	public int updatePropertyGroup(PropertyGroup pg) {
		
		return propertyGroupMapper.updatePropertyGroup(pg);
	}
	
	@Override
	public List<PropertyGroup> listPropertyGroupsByPId(String parentId) {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public void insertPropertyGroups(List<PropertyGroup> propertyGroups) {
		if (null == propertyGroups || 0 == propertyGroups.size()) {
			return;
		}
		int order = 1;
		for (PropertyGroup pg : propertyGroups) {
			pg.setOrder(order);
			insertPropertyGroup(pg);
			++order;
		}
	}
	
	public PropertyGroupMapper getPropertyGroupMapper() {
		return propertyGroupMapper;
	}
	
	public void setPropertyGroupMapper(PropertyGroupMapper propertyGroupMapper) {
		this.propertyGroupMapper = propertyGroupMapper;
	}
	
}
